package com.oa.system.tasks;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class HolidayTasks {

    @Autowired
    public JdbcTemplate jdbcTemplate;

    private static Logger logger = Logger.getLogger(HolidayTasks.class);

    //一天
    public final Integer ONE_DAY = 86400000;

    @Scheduled(fixedRate = 1000*60*60*24)
    public void remind() {
        logger.debug("定时任务消息 <----------> 已更新假期");
    }

    /**
     * 更新工龄假期
     */
    @Scheduled(cron = "59 59 23 31 12 ?")
    public void addSeniority(){
        jdbcTemplate.update("update pm_entry_information set seniority = seniority + 1 where seniority is not null");
        logger.debug("定时任务消息 <----------> 已更新工龄假期");
    }
}
